<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>margin 负值问题</title>
  <style type="text/css">
    body{
      margin:20px;
    }
    .float-left{
      float: left
    }
    .clearfix:after{
      content: '';
      display: table;
      clear: both;
    }
    .contianer{
      border: 1px solid #ccc;
      padding: 10px;
    }
    .contianer .item{
      width: 100px;
      height: 100px;
    }
    .contianer .border-blue{
      border: 1px solid blue;
    }
    .contianer .border-red{
      border: 1px solid red;
    }
  </style>
</head>
<body>
  <p>用于测试 margin top bottom 的负值问题</p>
  <div class="contianer">
    <div class="item border-blue">
      this is item 1
    </div>
    <div class="item border-red">
      this is item2
    </div>
  </div>

  <p>用于测试 margin top bottom 的负值问题</p>
  <div class="contianer clearfix">
    <div class="item border-blue float-left">
      this is item3
    </div>
    <div class="item border-red float-left">
      this is item4
    </div>
  </div>


  <h3>总结</h3>
  <ul>
    <li>margin-top 和 margin-left 负值，元素向上、向左移动</li>
    <li>margin-right 负值，右侧元素左移，自身不受影响</li>
    <li>margin-bottom 负值，下方元素上移动，自身不受影响</li>
  </ul>
</body>
</html>
